package com.yuexun.beilunpatient.ui.visit.ui;

import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.yuexun.beilunpatient.R;
import com.yuexun.beilunpatient.base.BaseKJActivity;
import com.yuexun.beilunpatient.widget.FixedSwipeListView;
import com.yuexun.beilunpatient.widget.timeUtil.CustomDatePicker;

import java.text.SimpleDateFormat;
import java.util.Date;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by chenss on 2018/4/13 0013.
 */

public class Act_Visit_Add extends BaseKJActivity {

    @Bind(R.id.patientName)
    TextView patientName;
    @Bind(R.id.patientSex)
    TextView patientSex;
    @Bind(R.id.patientAge)
    TextView patientAge;
    @Bind(R.id.patientPhone)
    TextView patientPhone;
    @Bind(R.id.patientIdentity)
    TextView patientIdentity;
    @Bind(R.id.patientCard)
    TextView patientCard;
    @Bind(R.id.visitDate)
    TextView visitDate;
    @Bind(R.id.type)
    TextView type;
    @Bind(R.id.helpList)
    FixedSwipeListView helpList;
    @Bind(R.id.animProgress)
    ProgressBar animProgress;
    @Bind(R.id.modelView)
    LinearLayout modelView;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_visit_add);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        visitDate.setText(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()));
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick({R.id.title_back, R.id.tv_submit, R.id.visitDate, R.id.type})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.title_back:
                finish();
                break;
            case R.id.tv_submit:
                break;
            case R.id.visitDate:
                CustomDatePicker customDatePicker = new CustomDatePicker(this, new CustomDatePicker.ResultHandler() {
                    @Override
                    public void handle(String time) { // 回调接口，获得选中的时间
                        visitDate.setText(time);
                    }
                }, "2010-01-01 00:00", visitDate.getText().toString() + " 00:00"); // 初始化日期格式请用：yyyy-MM-dd HH:mm，否则不能正常运行
                customDatePicker.setIsLoop(true); // 不允许循环滚动
                customDatePicker.show(visitDate.getText().toString() + " 00:00");
                break;
            case R.id.type:
                break;
        }
    }
}
